// B.cpp 戴朋代码
#include <bits/stdc++.h>
using namespace std;

int box[110];
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    int x;
    cin >> x;
    int pos = 1;
    if (x > 0) {
      pos = x;
    } else {
      for (int j = 1; j <= n; j++) {
        if (box[j] < box[pos]) {
          pos = j;
        }
      }
    }
    box[pos]++;
    cout << pos << " ";
  }

  return 0;
}